#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>

#define SYSCALL_GET_222 222
#define SYSCALL_PUT_223 223
#define SYSCALL_DEL_251 251

struct test_data {
   char *value;
   size_t vsize;
   char *key;
   size_t ksize;
};

void sys_get(const char *key, size_t ksize, const char *value, size_t vsize){
	syscall(SYSCALL_GET_222, key, ksize, value, vsize);	
}

int main(int argc, char * argv [ ]){
	char key[100];
	char value[100];
	
	struct test_data data;	
	data.key = key;
	data.value = value;

	while(1){
		puts("get>>");
		memset(key, 0, sizeof(key));
		memset(value, 0, sizeof(value));
	
		puts("key:");
		fgets(key, sizeof(key), stdin);
		key[strlen(key) - 1] = '\0';			//delete '\n'

		data.ksize = strlen(key) + 1;
		data.vsize = sizeof(value);

		syscall(SYSCALL_GET_222, data.key, data.ksize, 
								data.value, data.vsize);	
		
		fprintf(stdout, "[get] [%s(v)]\n", data.value);
	}

	return 0;
}


